home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 January - Disc 2
/
Macworld (1999-01) (Disk 2).dmg
/
Serious Demos
/
Symbolic Composer 4.2
/
Environment
/
Projects
/
Examples
/
How To
/
S-COM Lengths vs Lisp Ratios
< prev
next >
Wrap
Lisp/Scheme
|
1998-10-26
|
1KB
|
38 lines
If you want to process ratios you must use get-ratio,
(+ (get-ratio '3/1 :ratio) (get-ratio '3/4 :ratio))
Rational processing is changed in favour of length unit processing that
handles dots and -n divisions.
You can restore Lisp ratio processing with remove-new-ratio-parser.
SCOM Lengths vs. Lisp Ratios
You can switch between SCOM Lengths and Lisp ratio parsing with
two functions (remove-new-ratio-parser) and (install-new-ratio-parser).
(install-new-ratio-parser) is the default behaviour. It allows to
use length symbols that are greater than 1/1 and result to integers
without backslashing.
(setq zones '(1/1 1/2 1/3 1/4 ...))
(remove-new-ratio-parser) changes the ratio parsing back to standard
Lisp. In this mode you can calculate with ratios:
(+ 1/3 2/3)
1
You cannot naturally calculate with length symbols:
(+ 1/3. 1/4..)
In this mode you have to backslash all length symbols like 1/1, 2/1, 3/1.
(setq zones '(1\/1 2\/1 3\/1))
This looks confusing for the first time user, hence it the new-ratio-parser
is default.